package cc.rengu.oltp.service.model;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;

import java.io.Serializable;

/**
 * 业务异常类
 * Created by 王成 on 2017/7/3.
 */
public class BizException extends RuntimeException implements Serializable {
    private final String code;

    public BizException() {
        code = null;
    }

    public BizException(Throwable cause, String message) {
        super(message, cause);
        code = null;
    }

    public BizException(String message) {
        super(message);
        code = null;
    }

    public BizException(Throwable cause) {
        super(cause);
        code = null;
    }

    public BizException(OltpRpcdEnum respCodeEnum) {
        super(respCodeEnum.getRespDesc());
        this.code = respCodeEnum.getRespCode();
    }

    public BizException(String code, String message) {
        super(message);
        this.code = code;
    }

    public BizException(String code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public String getCode() {
        return code;
    }
}
